package com.hzgj.bcl.soa.rpc.retry;

public class RetryTimes extends RetryPolicy {
    private final int timesToRetry;

    /**
     * @param msBeforeRetry milliseconds before retrying
     * @param timesToRetry  number of times to retry
     */
    public RetryTimes(int msBeforeRetry, int timesToRetry) {
        super(msBeforeRetry);
        this.timesToRetry = timesToRetry;
    }

    @Override
    public boolean shouldRetry(InvokeState invokeState) {
        return invokeState.retryCount < timesToRetry;
    }
}